# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-ziamath
pkgver=0.7
pkgrel=2
pkgdesc="Render MathML and LaTeX Math to SVG without Latex installation"
url="https://ziamath.readthedocs.io/"
license=('MIT')
arch=('any')
depends=('python-ziafont')
optdepends=('python-latex2mathml: for latex support')
makedepends=('python-setuptools')
checkdepends=('python-latex2mathml' 'python-nbval' 'python-pytest-runner')
source=("$pkgname-$pkgver.tar.gz::https://bitbucket.org/cdelker/ziamath/get/$pkgver.tar.bz2")
sha512sums=('ff7b46fa5485bdf053a128da5acb9e973391eb3528b03251ddaa3574726821f8b38892a8d412e3a2f05aa95558e2ee8f1f07fb43fc89602677d398db26419732')

prepare() {
  mv cdelker-ziamath-* ziamath-$pkgver
}

build() {
  cd ziamath-$pkgver
  python setup.py build
}

check() {
  cd ziamath-$pkgver
  python setup.py pytest --addopts --nbval || echo "Tests failed"
}

package() {
  cd ziamath-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1

  install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
}
